package task;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 定时任务测试（scheduled方式）
 */
@Component
@Slf4j
public class TaskDemo {
    @Scheduled(cron = "0/5 * * * * ?")
    public void runTask() {
        log.info("定时任务执行了111");
        System.out.println("定时任务执行了111");
    }

    @Scheduled(fixedDelay = 5000)
    public  void runTask2() {
        log.info("定时任务执行了222");
        System.out.println("定时任务执行了222");
    }
}
